﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _19.ExtractsFromTextAllPalindromes
{
    class ExtractsFromTextAllPalindromes
    {
        static void Main(string[] args)
        {
            string text = "Civic is pertaining to cities.Deked is from DEKE, to feint in hockey.Deled is from DELE, to delete.";
            text = text.ToLower();
            char[] separators = { ' ', ',', '.', '!', '\n', '\r' };
            string[] words = text.Split(separators, StringSplitOptions.RemoveEmptyEntries);
            foreach (string word in words)
            {
                bool palindrome = true;
                for (int i = 0; i < word.Length / 2; i++)
                {
                    if (word[i] != word[word.Length - 1 - i])
                    {
                        palindrome = false;
                        break;
                    }
                }
                if (palindrome)
                {
                    Console.WriteLine(word);
                }
            }
        }
    }
}
